/*    */ package eos.moe.dragoncore;
/*    */ 
/*    */ import java.io.ByteArrayOutputStream;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.net.URI;
/*    */ import org.apache.http.HttpEntity;
/*    */ import org.apache.http.HttpResponse;
/*    */ import org.apache.http.client.methods.HttpGet;
/*    */ import org.apache.http.client.methods.HttpUriRequest;
/*    */ import org.apache.http.impl.client.CloseableHttpClient;
/*    */ import org.apache.http.impl.client.HttpClients;
/*    */ 
/*    */ public class id
/*    */ {
/*    */   public static byte[] v(URI a) throws IOException {
/* 17 */     CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
/* 18 */     HttpGet httpGet = new HttpGet(a);
/* 19 */     HttpResponse httpResponse = closeableHttpClient.execute((HttpUriRequest)httpGet);
/* 20 */     if (httpResponse.getEntity() == null || httpResponse.getStatusLine().getStatusCode() != 200) {
/* 21 */       throw new IOException("无法下载文件 " + a.toString() + ", status code: " + httpResponse.getStatusLine().getStatusCode() + ", reason: " + httpResponse.getStatusLine().getReasonPhrase());
/*    */     }
/* 23 */     HttpEntity httpEntity = httpResponse.getEntity();
/* 24 */     InputStream inputStream = httpEntity.getContent();
/* 25 */     ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
/* 26 */     byte[] arrayOfByte = new byte[10240];
/*    */     int i;
/* 28 */     while ((i = inputStream.read(arrayOfByte)) != -1) {
/* 29 */       byteArrayOutputStream.write(arrayOfByte, 0, i);
/*    */     }
/* 31 */     inputStream.close();
/* 32 */     byteArrayOutputStream.close();
/* 33 */     return byteArrayOutputStream.toByteArray();
/*    */   }
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\eos\moe\dragoncore\id.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */